package com.charity.rest.controller.manage.website;

import java.util.List;
import com.charity.website.service.IWebMenuService;
import com.charity.website.vo.model.WebMenuModel;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 网站菜单  前端控制器
 *
 */
@RestController
@RequestMapping("/manage/manageWebMenu")
@AllArgsConstructor
public class ManageWebMenuController {

    private final IWebMenuService webMenuService;

    @PostMapping("/getTreeList")
    public List<WebMenuModel> getTreeList(@RequestBody WebMenuModel model) {
        return webMenuService.getTreeList(model);
    }

    @GetMapping(value = "/{id}")
    public WebMenuModel getWebMenuById(@PathVariable("id") Long id) {
        return webMenuService.getWebMenuById(id);
    }

    @PostMapping("/createWebMenu")
    public Long createWebMenu(@RequestBody WebMenuModel model) {
        return webMenuService.createWebMenu(model);
    }

    @PostMapping("/updateWebMenu")
    public void updateWebMenu(@RequestBody WebMenuModel model) {
        webMenuService.updateWebMenu(model);
    }

    @DeleteMapping("/{id}")
    public Integer deleteWebMenu(@PathVariable("id") Long id) {
        return webMenuService.deleteWebMenu(id);
    }
}
